// @ts-ignore
/* eslint-disable */
import { request } from 'umi';

/** 登录接口 */
export async function login(body: API.LoginParams, options?: { [key: string]: any }) {
  return request<API.LoginResult>('/login', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 获取当前的用户 */
export async function currentUser(options?: { [key: string]: any }) {
  return request<{
    data: API.CurrentUser;
  }>('/login/index/getuser', {
    method: 'GET',
    ...(options || {}),
  });
}

/** 获取权限菜单，包括权限按钮 */
export async function getPermissions(options?: { [key: string]: any }) {
  return request<{
    data: API.MenuItem[];
  }>('/system/index/getrule', {
    method: 'POST',
    ...(options || {}),
  });
}
